package com.jsonal.common;

import java.util.Random;

/**
 * @Author: jingji.lin
 * @Description:
 * @Date: 2020/4/21 13:42
 * @Version: 1.0
 */
public class ValidCode {


    /**
     * 生成随机6位数验证码
     *
     * @return 验证码
     */
    public static String getCode() {
        /**
         * 建议使用
         */
        StringBuilder str = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 6; i++) {
            str.append(random.nextInt(10));
        }
        return str.toString();

    }
}
